<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>当地时间</title>
</head>
<body>
<button onclick="int=window.clearInterval(int)">刷新</button>
<input type="text" id="clock">
</body>
<script>
    var int=self.setInterval("clock()");
    function clock()
    {
        var d=new Date();
        var t=d.toLocaleTimeString();
        document.getElementById("clock").value=t;
    }
</script>
</html>